using System;
using System.Collections.Generic;
using Abs.Core.DAL.EntityFramework;
using Abs.Core.Models;
using Abs.Core.Models.Room;

namespace Abs.Core.DAL.SetUpDatabase
{
    internal partial class AbsInitializer
    {
        private void InitializeRoomSchedule(IList<Day> days, IList<Room> rooms, AbsContext absContext)
        {
            var roomSchedules = new List<RoomSchedule>
                                {
                                    new RoomSchedule
                                    {
                                        RoomId = 1,
                                        Room = rooms[0],
                                        DayId = (int) DayOfWeek.Monday,
                                        Day = days[(int) DayOfWeek.Monday],
                                        StartTime = DateTime.Parse("07:00:00"),
                                        EndTime = DateTime.Parse("17:00:00")
                                    },
                                    new RoomSchedule
                                    {
                                        RoomId = 1,
                                        Room = rooms[0],
                                        DayId = (int) DayOfWeek.Tuesday,
                                        Day = days[(int) DayOfWeek.Tuesday],
                                        StartTime = DateTime.Parse("07:00:00"),
                                        EndTime = DateTime.Parse("17:00:00")
                                    },
                                    new RoomSchedule
                                    {
                                        RoomId = 2,
                                        Room = rooms [1],
                                        DayId = (int) DayOfWeek.Tuesday,
                                        Day = days[(int) DayOfWeek.Tuesday],
                                        StartTime = DateTime.Parse("07:00:00"),
                                        EndTime = DateTime.Parse("20:00:00")
                                    },
                                    new RoomSchedule
                                    {
                                        RoomId = 3,
                                        Room = rooms[2],
                                        DayId = (int) DayOfWeek.Tuesday,
                                        Day = days[(int) DayOfWeek.Tuesday],
                                        StartTime = DateTime.Parse("07:00:00"),
                                        EndTime = DateTime.Parse("20:00:00")
                                    },
                                    new RoomSchedule
                                    {
                                        RoomId = 4,
                                        Room = rooms[3],
                                        DayId = (int) DayOfWeek.Wednesday,
                                        Day = days[(int) DayOfWeek.Wednesday],
                                        StartTime = DateTime.Parse("08:00:00"),
                                        EndTime = DateTime.Parse("18:00:00")
                                    }
                                };
            roomSchedules.ForEach(roomSchedule => absContext.RoomSchedules.Add(roomSchedule));
            absContext.SaveChanges();
        }//end of private IList<RoomSchedule> InitializeRoomSchedule(IList<Room> rooms, AbsContext absContext)
    }//end of public partial class AbsInitializer
}//end of namespace ABS.DAL